<template>
<div>
  <van-nav-bar title="更改昵称" left-text="返回" left-arrow @click-left="$router.back()" />
  
  <van-field v-model="value"  label="用户名" placeholder="请输入用户名" />
  <van-button plain type="primary" @click="setName">确认修改</van-button>

</div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { showSuccessToast, showFailToast } from 'vant';

const router = useRouter()
const value = ref('')
// const name = ''
let setName = ()=>{
  // console.log(value.value);
  window.localStorage.setItem("name",value.value)
  showSuccessToast('修改成功');
  router.push('/my')

}
</script>
 
<style scoped>
  .van-button{
    margin-left:150px;
    margin-top: 10px;
  }
</style>